﻿<!--#include file="h.asp"--><%
'
'	七色虎建站系统
'	会员发信息页面
'	2011.11.2

Sub main
	Dim id,userid,a,body_
	Dim state,text,count
	checkLogin()'验证登录
	checkUserStatus()'检测用户是否在服刑
	body_ = ""
	id=getN("id", 0)
	userid=user_array(0)
	hu.title = "发信息"
	body_ = comUbb("[div=nav]-"&hu.url("?aid=index","首页") &"-"&hu.url("bbs_user.asp","会员中心")&"-发信息[/div]")
	a=getN("a", 0)
	If id=userid Then rupt "错误","不能给自己发信息"
	'是否自己好友
	state= getFriendship(id)
	If state<>1 Then rupt "错误", "对方还不是你好友,请添加好友后发信息<br/>"&showImg("friend")&hu.url("bbs_friend.asp?id="&id,"加对方为好友")
	If a=0 Then
		Dim formarray(2)
		formarray(0) = http_path&"bbs_msg.asp?a=1||post||发送"
		formarray(1) = "input||text$$$$20$$200||<br/>"
		formarray(2) = "hidden||id$$"&id&"||"&bbsSid&"$$"&sid&"||"
		body_ = body_ &  hu.getForm(formarray)
	Else
		text=getD("text", "")
		If text="" Then
			body_ = body_ & "信息不能为空!"
		Else
			'防止刷信息,30秒发信一条
			count=hu.conn("select count(id) from 74hu_message where userid="&userid&" and (savetime>#"&dateadd("s", -30, time_now)&"#)")(0)
			If count>0 Then rupt "错误", "为提高聊天质量,两次信息间隔必须大于30秒!"
			hu.conn("insert into 74hu_message (userid,receive,content,savetime,state,flag) values("&userid&","&id&",'"&text&"','"&time_now&"',0,0)")
			body_ = body_ & "信息发送成功!"
		End If
	End If
	hu.body = body_ & "<br/>"
End Sub

%>